﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="Nivdal.coach" StylesheetTheme="SkinFile" Codebehind="coach.aspx.cs" %>

<%@ Register Assembly="obout_Flyout2_NET" Namespace="OboutInc.Flyout2" TagPrefix="cc1" %>

<asp:Content ID="PageNameContent" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:HiddenField ID="CoachIdHiddenField" runat="server" />
    <asp:Panel ID="MessagePanel" runat="server">
        <asp:Label ID="MessageLabel" runat="server" Text="" SkinID="ErrorLabel"></asp:Label>
        <asp:Label ID="ErrorLabel" runat="server" Text=""></asp:Label>  
    </asp:Panel>  
    <div class="basic_element">
        <asp:FormView ID="CoachFormView" runat="server" DataSourceID="ShowCoachDetailsSqlDataSource" Width="100%" >
        <ItemTemplate>
            <div class="red_title_no_padding">
            <div class="grey_title_inside_red floater">
                <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' CssClass="white_title" />
                &nbsp;&nbsp;
                <asp:Label ID="CoachIdTitleLabel" runat="server" Text="<%$ Resources:Resource, coach_CoachIdTitleLabel %>" CssClass="team_id_white"></asp:Label>
                <asp:Label ID="CoachIdLabel" runat="server" Text='<%# Eval("Id") %>' CssClass="team_id_white" />
            </div>
            <div class="grey_title_triangle floater"></div>
            <div class="floater padding_top2"> 
                <asp:Hyperlink ID="CountryFlag" runat="server" ImageUrl='<%# Eval("Flag", "~/Images/Flags/{0}") %>' ToolTip='<%# Eval("CountryName") %>'
                  NavigateUrl='<%# Eval("CountryId", "Country.aspx?Id={0}") %>' CssClass="rounded_corners"></asp:Hyperlink>
                <asp:ImageButton ID="BookmarkButton" runat="server" OnClick="BookmarkButton_Click" Visible='<%# IsPremium() %>' 
                ImageUrl="~/Images/bookmarks.png" ToolTip="<%$ Resources:Resource, coach_BookmarkButton %>" CssClass="AllignBottomStyle" />
            </div>
            </div>
            <div class="padding5">
                
                <asp:Label ID="AgeTitleLabel" runat="server" Text='<%# Resources.Resource.Global_Age + ":"%>' SkinID="InfoLabel" ></asp:Label>
                <asp:Label ID="AgeLabel" runat="server" Text='<%# Eval("Age") %>' SkinID="GridLabel" />
                <br />
                <asp:Label ID="LabelTitle" runat="server" Text='<%# Resources.Resource.Global_Level+ ":"%>' SkinID="InfoLabel"></asp:Label>
                <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Level") %>' SkinID="GridLabel" />
                <br />
                <asp:Label ID="CharismaTitleLabel" runat="server" Text='<%# Resources.Resource.Global_Charisma + ":"%>'  SkinID="InfoLabel"></asp:Label>
                <asp:Label ID="CharismaLabel" runat="server" Text='<%# Eval("Charisma") %>' SkinID="GridLabel" />
                <br />
                <asp:Label ID="CurrentSalaryTitleLabel" runat="server" Text="<%$ Resources:Resource, coach_CurrentSalaryTitleLabel %>" SkinID="InfoLabel"></asp:Label>
                <asp:Label ID="CurrentSalaryLabel" runat="server" Text='<%# GetNivdalData.GetNivdalData.FormattedNumber(Eval("CurrentSalary")) %>'
                    SkinID="GridLabel" />
                <br />
                <asp:Label ID="NextNegotiationsDateTitleLabel" runat="server" Text="<%$ Resources:Resource, Player_ContractTill %>"
                    SkinID="InfoLabel"></asp:Label>
                <asp:Label ID="NextNegotiationsDateLabel" runat="server" Text='<%# Eval("NegDate") %>' SkinID="GridLabel"></asp:Label>
                <br />
                <asp:Label ID="TeamNameTitleLabel" runat="server" Text='<%# Resources.Resource.Global_TeamName+ ":"%>' SkinID="InfoLabel"></asp:Label>
                <asp:LinkButton ID="TeamNameLinkButton" runat="server" Text='<%# Eval("Team name") %>'
                    PostBackUrl='<%# Eval("TeamId", "TeamHomePage.aspx?TeamId={0}") %>' SkinID="GreenTitleLink"></asp:LinkButton>
                <br />
                <asp:Label ID="NoteLabel" runat="server" Text='<%# Eval("Note") %>' SkinID="GridLabel" />
                        
            </div>
            
        </ItemTemplate>
        </asp:FormView>
         <br />   
        <asp:Button ID="ReleaseButton" runat="server" Text="<%$ Resources:Resource, coach_ReleaseButton %>" 
        OnClick="ReleaseButton_Click" CssClass="GreenButtonTextStyle" />
    </div>
    <asp:Panel ID="BidOnCoachPanel" runat="server" Visible="false">
        <asp:UpdatePanel ID="BidUpdatePanel" runat="server" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="BidTimer" EventName="Tick" />
        </Triggers>
        <ContentTemplate>
            <asp:Timer ID="BidTimer" runat="server" Interval="30000" OnTick="BidTimerTick">                
            </asp:Timer>
            <asp:FormView ID="FormView1" runat="server" DataSourceID="ShowFreeCoachInfoSqlDataSource">
                <ItemTemplate>
                <div class="basic_element">
                <div class="padding5">
                    <asp:Label ID="CoachIsForSaleLabel" runat="server" Text="<%$ Resources:Resource, coach_CoachIsForSaleLabel %>" SkinID="InfoLabel"></asp:Label>
                    <br />
                    <asp:Label ID="BidDeadlineTitleLabel" runat="server" Text="<%$ Resources:Resource, Global_BidDeadLine %>" SkinID="InfoLabel"></asp:Label>
                    <asp:Label ID="CoachIdLabel" runat="server" Text='<%# Eval("BidDeadline") %>' SkinID="GridLabel" />
                    <br />
                    <asp:Label ID="CurrentBidTitleLabel" runat="server" Text='<%# Resources.Resource.Global_CurrentBid+ ":"%>' SkinID="InfoLabel"></asp:Label>
                    <asp:Label ID="CurrentBidLabel" runat="server" Text='<%# Eval("CurrentBid") %>' SkinID="GridLabel" />
                    <br />                
                    <asp:Label ID="BiddingTeamNameLabel" runat="server" Text='<%# Resources.Resource.Globl_BiddingTeamName+ ":"%>' SkinID="InfoLabel"></asp:Label>
                    <asp:Hyperlink ID="BiddingTeamNameLinkButton" runat="server" Text='<%# Eval("BiddingTeamName") %>'
                        NavigateUrl='<%# Eval("BiddingTeamId", "TeamHomePage.aspx?TeamId={0}") %>'
                        SkinID="GreenTitleHyperLink" Visible='<%# Eval("LinkToBiddingTeamVisible") %>'></asp:Hyperlink>
                    <asp:Label ID="NoteLabel" runat="server" Text="<%$ Resources:Resource, coach_NoteLabel %>" SkinID="GridLabel"
                     Visible='<%# Eval("NoteVisible") %>'></asp:Label>
                    <br />
                    <asp:Label ID="NextPossibleBidTitleLabel" runat="server" Text="<%$ Resources:Resource, coach_NextPossibleBidTitleLabel %>"
                        SkinID="InfoLabel"></asp:Label>
                    <asp:Label ID="NextPossibleBidLabel" runat="server" Text='<%# Eval("NextPossibleBid") %>'
                        SkinID="GridLabel" />
                    <asp:Button ID="BidButton" runat="server" Text="<%$ Resources:Resource, Global_Bid %>" OnClick="BidButton_Click" 
                        CssClass="GreenSmallButtonStyle" OnClientClick='<%# BidButtonOnClientClick(Eval("NextPossibleBid").ToString())%>'  /> 
                    <asp:FormView ID="ConditionalBidFormView" runat="server" DataSourceID="ConditionalBidOnCoachDataSource" 
                    OnItemCommand="ConditionalBidItemCommand" Visible='<%# IsPremium() %>'>
                    <ItemTemplate>
                        <asp:Panel ID="PutBidPanel" runat="server" Visible='<%#!(bool)Eval("ConditionalBidExists") %>'>
                            <asp:Label ID="PutBidtitleLabel" runat="server" SkinID="InfoLabel" Text="<%$ Resources:Resource, PutBidtitleLabelText %>"></asp:Label> 
                            <asp:TextBox ID="ConditionalBidTextBox" runat="server" MaxLength="12" ValidationGroup="Bid" TextMode="SingleLine" Width="85"></asp:TextBox>
                            <asp:Image ID="AtukImage1" runat="server" ImageUrl="~/Images/Icons/atuk.png" style="vertical-align:middle" />
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="*" ControlToValidate="ConditionalBidTextBox"
                             ValidationExpression="[1-9][0-9][0-9][0-9][0-9]*" SetFocusOnError="true" ValidationGroup="Bid" ></asp:RegularExpressionValidator>
                            &nbsp;
                            <asp:Button ID="SetConditionalBidButton" runat="server" Text="<%$ Resources:Resource, Global_Set %>" 
                            CommandName="Set" CssClass="GreenSmallButtonStyle" ValidationGroup="Bid" CausesValidation="true"  /> 
                            <asp:Image ID="ConditionalBidHelpImage2" runat="server" ImageUrl="~/Images/question.gif" AlternateText="<%$ Resources:Resource, coach_ConditionalBidHelpImageAlternateText %>"  style="vertical-align:middle;" />
                            <cc1:Flyout ID="Flyout2" runat="server" AttachTo="ConditionalBidHelpImage2" FadingEffect="true">
                                <div class="ToolTipStyle" style="width:300px;">
                                    <asp:Label ID="ToolTipLabel" runat="server" Text="<%$ Resources:Resource, Player_ConditionalBidHelp %>"></asp:Label>
                                </div>
                            </cc1:Flyout>
                            <cc1:Flyout ID="AtukFlyout2" runat="server" AttachTo="AtukImage1" FadingEffect="true">
                                <div class="ToolTipStyle">
                                    <asp:Label ID="Label5" runat="server" Text="<%$ Resources:Resource, Atuks %>"></asp:Label>
                                </div>
                            </cc1:Flyout>
                              
                        </asp:Panel>
                        <asp:Panel ID="BidExistsPanel" runat="server" Visible='<%# Eval("ConditionalBidExists") %>'>
                            <asp:Label ID="ConditionalBidLabel" runat="server" Text='<%# "Conditional bid of " + Eval("ConditionalBidSum") + " is set" %>'
                             SkinID="InfoLabel"></asp:Label>
                            <br />
                            <asp:Button ID="DeleteConditionalBidButton" runat="server" Text="Delete conditional bid" CssClass="GreenSmallButtonStyle"
                             CommandName="Delete" CommandArgument='<%# Eval("ConditionalBidId") %>' />
                            <asp:Image ID="ConditionalBidHelpImage1" runat="server" ImageUrl="~/Images/question.gif" AlternateText="<%$ Resources:Resource, coach_ConditionalBidHelpImageAlternateText %>" style="vertical-align:middle;" />
                            <cc1:Flyout ID="Flyout1" runat="server" AttachTo="ConditionalBidHelpImage1" FadingEffect="true">
                                <div class="ToolTipStyle">
                                    <asp:Label ID="Label6" runat="server" Text="<%$ Resources:Resource, Player_ConditionalBidHelp %>"></asp:Label>
                                </div>                            
                            </cc1:Flyout>        
                        </asp:Panel>
                    </ItemTemplate>
                    </asp:FormView> 
                </ItemTemplate>
            </asp:FormView>
            </div>
            </div>
        

            <asp:SqlDataSource ID="ConditionalBidOnCoachDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetConditionalBidOnCoachInfo" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
            <asp:SqlDataSource ID="ShowFreeCoachInfoSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_TrainingGetFreeCoachInfo" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
            <asp:SqlDataSource ID="ShowCoachDetailsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                SelectCommand="Nivdal_TrainingShowCoachDetails" SelectCommandType="StoredProcedure">
            </asp:SqlDataSource>
        </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Panel>
    <div class="basic_element">
    <div class="red_title">
       <asp:Label ID="CoachTransfersTitleLabel" runat="server" Text="<%$ Resources:Resource, Coach_TransfersTitle %>" CssClass="white_title"></asp:Label>
    </div>
    <div class="padding5">
        <asp:GridView ID="CoachTransfersGridview" runat="server" DataSourceID="CoachTransfersDataSource" AutoGenerateColumns="false"
         SkinID="Professional" AllowPaging="false">
        <EmptyDataTemplate>
            <asp:Label ID="NoTransfersLabel" runat="server" Text="<%$ Resources:Resource, Coach_NoTransfers %>" SkinID="GridLabel"></asp:Label>
        </EmptyDataTemplate>
        <Columns>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Date %>">
                <ItemTemplate>
                    <asp:Label ID="TransferDateLabel" runat="server" Text='<%# Eval("Date") %>' SkinID="GridLabel"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_From %>" >
                <ItemTemplate>
                    <asp:HyperLink ID="FromTeamLink" runat="server" NavigateUrl='<%# "TeamHomePage.aspx?TeamId=" + Eval("FromTeamId") %>'
                     Text='<%# Eval("FromTeamName") %>' Visible='<%# Eval("FromVisible") %>' SkinID="GreenTitleHyperLink"></asp:HyperLink>
                    <asp:Label ID="FromFreeAgentLabel" runat="server" Text="<%$ Resources:Resource, Coach_FreeAgent %>"
                     SkinID="GridLabel" Visible='<%# !(bool)Eval("FromVisible") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_To %>" >
                <ItemTemplate>
                    <asp:HyperLink ID="ToTeamLink" runat="server" NavigateUrl='<%# "TeamHomePage.aspx?TeamId=" + Eval("ToTeamId") %>'
                     Text='<%# Eval("ToTeamName") %>' Visible='<%# Eval("ToVisible") %>' SkinID="GreenTitleHyperLink"></asp:HyperLink>
                    <asp:Label ID="ToFreeAgentLabel" runat="server" Text="<%$ Resources:Resource, Coach_FreeAgent %>"
                     SkinID="GridLabel" Visible='<%# !(bool)Eval("ToVisible") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, TeamTransfers_TransferSumHeaderText %>">
                <ItemTemplate>
                    <asp:Label ID="TransferSumLabel" runat="server" Text='<%# ParceNumber(Eval("TransferSum")) %>' SkinID="GridLabel"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="CoachTransfersDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetCoachTransfers" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
    </div>
    </div>
    
    
    

</asp:Content>
